<template>
	<view class="container">
		<empty v-if='cartList.length===0'></empty>
		<cart-item ref='cart' v-else :cartList="cartList" :hasLogin="hasLogin"></cart-item>
	</view>
</template>

<script>
	import empty from '@/components/shopComponents/cart/empty.vue'
	import cartItem from '@/components/shopComponents/cart/cart-item.vue'
	import mockData from '@/data/cart.js'
	export default {
		components: {
			empty,
			cartItem
		},
		data() {
			return {
				cartList:{}
			};
		},
		onReady() {
			// this.cartList=mockData.cartList;
			this.mallShoppingcar_list()
		},
		methods: {
			mallShoppingcar_list() {//获取购物车列表
				var _this=this;
				uni.request({
					url:this.$API.mallShoppingcar_list,
					method:"POST",
					data:{u_id:_this.userid},
					header:this.$API.get_head(),
					success: (res) => {
						_this.cartList=res.data.rows;
						
						
						for(var i=0;i<_this.cartList.length;i++){
							_this.cartList[i].checked=false;
							_this.cartList[i].cover_pic = _this.$API.baseURL+_this.cartList[i].cover_pic;
							// _this.list.rows[i].activeIMG='/static/icon_choose_nor.png';
						}
					},
					fail: () => {
						uni.showToast({
							title:"加载失败",
							icon:'none'
						})
					 }
				})
			},

		}
	}
</script>

<style lang='scss'>
	.container {
		padding-bottom: 134upx;

	}
</style>
